package sctu.edu.java.year2016.team05.lizixin.day20160614.LianXi6;

/**
 * Created by home on 2016/6/14.
 * 12.3
 */

import java.io.*;

public class FileTest {
    public static void main(String[] args) {
        File file = new File("D:/JAVA", "work.txt");
        try {
            FileOutputStream out = new FileOutputStream(file);
            byte buy[] = "明日科技 java 部".getBytes();
            out.write(buy);
            out.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
        try {
            FileInputStream in = new FileInputStream(file);
            byte byt[] = new byte[1024];
            int len = in.read(byt);
            System.out.println("文件中的信息是：" + new String(byt, 0, len));
            in.close();
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}
